package panel

type Shelf struct {
    Common
    l, r Type
}

func NewShelf(x, y Type) Type {
    shelf := &Shelf{Common{nil, 0, 0, 0, 0}, x, y}
    x.Parent(shelf)
    y.Parent(shelf)
    return shelf
}

func (s *Shelf) FocusForClick(line, col int) Type {
    if col < s.Cols/2 { return s.l.FocusForClick(line, col) }
    return s.r.FocusForClick(line, col - s.Cols/2)
}

func (s *Shelf) Key(rune int) Type {
    return nil
}

func (s *Shelf) Refresh() {
	Log("Shelf.Refresh")
    s.l.Refresh()
    s.r.Refresh()
}

func (s *Shelf) Resize(lines, cols int, lineOffset, colOffset int) {
    s.Common.Resize(lines, cols, lineOffset, colOffset)
    s.l.Resize(lines, cols/2, 0, 0)
    s.r.Resize(lines, cols - cols/2, 0, cols/2)
}